ResolveContext context = getResolveContext(Arrays.asList(resA, resB), null); Map<Resource, List<Wire>> wiremap = resolver.resolveAndApply(context);
A Resolver can find a consistent wiring solution for set of Resources in the given ResolveContext.
A ResolveContext contains a set mandatory and optional Resources. It is also the provider all possible Capability candidates (i.e. already resolved Resources in a runtime environment).
Resource resolution is deterministic and leads to the same result for a given set of Resources. The Resolver is thread safe and state less.
When multiple Capability candidates can be found for a given Requirement, the Resolver must make a preference selection. This is abstracted by the PreferencePolicy
The default implementation prefers
already resolved resources over unresolved resources
higher capability versions
In case the mandatory set of resources from the ResolveContext cannot be resolved, the Resolver will throw a ResolutionException with the set of unresolved Requirements.
An attempt to resolve a given set of Resources will not change the state of any Resource. However, when the Resolver is called like this
ResolveContext context = getResolveContext(Arrays.asList(resA, resB), null); Map<Resource, List<Wire>> wiremap = resolver.resolveAndApply(context);
we can get the updated Wiring for every Resource.